//
//  HLStatusesUser.swift
//  HLwWeibo
//
//  Created by hqhxu on 16/3/3.
//  Copyright © 2016年 hqhxu. All rights reserved.
//

import UIKit

class HLStatusesUser: NSObject {

    /// 用户UID
    var id: Int64 = 0
    
    /// 用户昵称
    var screen_name: String?
    
    /// 用户头像地址（中图），50×50像素
    var profile_image_url: String?

    /// verified_type 没有认证:-1   认证用户:0  企业认证:2,3,5  达人:220
    var verified_type: Int = -1 {
        //直接把图片返回出去
        /// verifiedImage认证图标
        didSet {
            switch verified_type {
            case 0:
                verifiedImage = UIImage(named: "avatar_vip")
            case 2,3,5:
                verifiedImage = UIImage(named: "avatar_enterprise_vip")
            case 220:
                verifiedImage = UIImage(named: "avatar_grassroot")
            default:
                verifiedImage = nil
            }
        }
    }
    
    /// 认证用户图片
    var verifiedImage:UIImage?
    
    
    /// 会员等级 会员等级 1-6
    var mbrank:Int = 0 {
        didSet {
            if mbrank > 0 && mbrank <= 6 {
                mbrankImage = UIImage(named: "common_icon_membership_level\(mbrank)")
            } else {
                mbrankImage = nil
            }
        }
    }
    /// mbrankImage会员图标
    var mbrankImage:UIImage?
    
    /// 构造方法
    init(dict:[String:AnyObject]) {
        super.init()
        setValuesForKeysWithDictionary(dict)
    }
    
    /// 防止字典转模型的时候崩掉
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
        // 如果当前模型中的属性中还有是字典的属性 那么就可以通过判断key值来再转一次模型
    }
    
    /// 重写输出方法
    override var description: String {
        let keys = ["id","screen_name","profile_image_url","verified_type","mbrank"]
        
        return "\n\t statuseUser模型:\(dictionaryWithValuesForKeys(keys).description)"
    }
    
    

}
